<?php
 @header("content-type:text/html;charset=utf-8");
 @header("Access-Control-Allow-Origin:*");
 mysql_connect("localhost:3306","root","root");
 mysql_select_db("1904");
 mysql_query("set character set utf8");
 mysql_query("set names utf8");
//  $con=$_GET["con"];
//  $orderType=$_GET["orderType"];
//  $order=$_GET["order"];
//  $showNum=$_GET["showNum"]*1;
//  $pageindex=$_GET["pageindex"]*1;
//  $kshowNum=$showNum*($pageindex-1);
// //  var_dump($pageindex);
//  $sql="select * from goodslist where goods_title like '%$con%' order by $orderType $order limit $kshowNum,$showNum";
//  $result=mysql_query($sql);
// //  echo($result)
//  $goodslist=array();
//  while($item=mysql_fetch_row($result)){
//  $goodslist[]=$item;
//  }
//  echo json_encode($goodslist)
$con = $_GET["con"];
$orderType = $_GET["orderType"];
$type = $_GET["order"];
$pageIndex = $_GET["pageindex"]; // 1
$showNum = $_GET["showNum"]; // 5

$skipNum = $pageIndex*$showNum;

$sql = "select * from goodlist where goods_menu like '%$con%' order by $orderType $type limit $skipNum,$showNum ";
// echo $sql;

$result = mysql_query($sql);
// $item = mysql_fetch_array($result);


$all = array();
while($item = mysql_fetch_assoc($result)){
    // $arr = array();
    // $arr["goods_id"] = $item["goods_id"];
    // $arr["goods_title"] = $item["goods_title"];
    // $arr["goods_price"] = $item["goods_current_price"];
    // $arr["goods_trade_num"] = $item["goods_trade_num"];
    // $arr["goods_pic"] = $item["goods_pic"];
    // $arr["goods_sub_pic"] = explode(",", $item["goods_sub_pic"]);
    // $arr["type"] =  $item["type"];

    // $all[] = $arr;
    $all[]=$item;
}

echo json_encode($all);
?>